package com.imy.lua.code;

public class ColorCodeMaker {

    public static String getColorCode(String color, int upX, int upY) {
        String code = "  local res = Screen:capture();\n" +
                "    local color = Image:pixel(res," + upX + "," + upY + ");\n" +
                "    if color ==\"" + color + "\"" + " then\n" +
                "        --找到了\n" +
                "    else\n" +
                "        --未找到\n" +
                "    end";
        return code;
    }

    public static String getFindColorInRegionCode(String color, int startX,
                                                  int starY, int width, int height, float dim) {
        String code = "  local res = Screen:capture();\n" +
                "    --在起始坐标 X " + startX + ",Y " + starY + "宽 " + width + "并且高"+height+"的矩形区域寻找"+color+"颜色;模糊度为"+dim+" 1为100%匹配\n" +
                "    local point = Image:findColorInRegion(res, \""+color+"\", "+startX+"," +starY+","+width+", "+height+","+dim+");\n" +
                "    if point == nil then\n" +
                "      --  没找到\n" +
                "    else\n" +
                "       -- 找到了\n" +
                "    end";
        return code;
    }


}
